<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Output text in a box</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.ps-shfill.html">« ps_shfill</a></li>
      <li style="float: right;"><a href="function.ps-show-xy2.html">ps_show_xy2 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.ps.html">PS 函数</a></li>
    <li>Output text in a box</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.ps-show-boxed" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ps_show_boxed</h1>
  <p class="verinfo">(PECL ps &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">ps_show_boxed</span> &mdash; <span class="dc-title">Output text in a box</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ps-show-boxed-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ps_show_boxed</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">resource</span> <code class="parameter">$psdoc</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$text</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">float</span> <code class="parameter">$left</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">float</span> <code class="parameter">$bottom</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">float</span> <code class="parameter">$width</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">float</span> <code class="parameter">$height</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$hmode</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$feature</code><span class="initializer"> = ?</span></span><br>): <span class="type">int</span></div>

  <p class="para rdfs-comment">
   Outputs a text in a given box. The lower left corner of the box is at
   (<code class="parameter">left</code>, <code class="parameter">bottom</code>). Line breaks
   will be inserted where needed. Multiple spaces are treated as one.
   Tabulators are treated as spaces.
  </p>
  <p class="para">
   The text will be hyphenated if the parameter
   <code class="parameter">hyphenation</code> is set to <strong><code>true</code></strong>
   and the parameter <code class="parameter">hyphendict</code> contains a valid
   filename for a hyphenation
   file. The line spacing is taken from the value <code class="literal">leading</code>.
   Paragraphs can be
   separated by an empty line just like in TeX. If the value
   <code class="literal">parindent</code> is
   set to value &gt; 0.0 then the first n lines will be indented. The number n
   of lines is set by the parameter <code class="literal">numindentlines</code>.
   In order to prevent
   indenting of the first m paragraphs set the value
   <code class="literal">parindentskip</code> to a
   positive number.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ps-show-boxed-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">psdoc</code></dt>

     <dd>

      <p class="para">
       Resource identifier of the postscript file
       as returned by <span class="function"><a href="function.ps-new.html" class="function">ps_new()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">text</code></dt>

     <dd>

      <p class="para">
       The text to be output into the given box.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">left</code></dt>

     <dd>

      <p class="para">
       x-coordinate of the lower left corner of the box.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">bottom</code></dt>

     <dd>

      <p class="para">
       y-coordinate of the lower left corner of the box.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">width</code></dt>

     <dd>

      <p class="para">
       Width of the box.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">height</code></dt>

     <dd>

      <p class="para">
       Height of the box.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">hmode</code></dt>

     <dd>

      <p class="para">
       The parameter <code class="parameter">hmode</code> can be <code class="literal">justify</code>,
       <code class="literal">fulljustify</code>, <code class="literal">right</code>, <code class="literal">left</code>, or <code class="literal">center</code>.
       The difference of <code class="literal">justify</code> and <code class="literal">fulljustify</code> just affects the last line of the box. In
       <code class="literal">fulljustify</code> mode the last line will be left and right justified unless
       this is also the last line of paragraph. In <code class="literal">justify</code> mode it will always
       be left justified.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">feature</code></dt>

     <dd>

      <p class="para">
       
      </p>
     </dd>

    
   </dl>

  </p>

  <div class="refsect2 unknown-parametert" id="refsect2-function.ps-show-boxed-unknown-parametert">
   <h4 class="title">Used parameters</h4>
   <p class="para">
    The output of <span class="function"><strong>ps_show_boxed()</strong></span> can be configured with
    several parameters and values which must be set with either
    <span class="function"><a href="function.ps-set-parameter.html" class="function">ps_set_parameter()</a></span> or <span class="function"><a href="function.ps-set-value.html" class="function">ps_set_value()</a></span>.
    Beside the parameters and values which affect text output, the following
    parameters and values are evaluated.
    <dl>
     
      <dt>
leading (value)</dt>

      <dd>

       <p class="para">Distance between baselines of two consecutive lines.</p>
      </dd>

     
     
      <dt>
linebreak (parameter)</dt>

      <dd>

       <p class="para">
        Set to <code class="literal">true</code> if you want a carriage return to start a new line instead
        of treating it as a space. Defaults to <code class="literal">false</code>.
       </p>
      </dd>

     
     
      <dt>
parbreak (parameter)</dt>

      <dd>

       <p class="para">
        Set to <code class="literal">true</code> if you want a carriage return on a single line to start a
        new paragraph instead of treating it as a space. Defaults to <code class="literal">true</code>.
       </p>
      </dd>

     
     
      <dt>
hyphenation (parameter)</dt>

      <dd>

       <p class="para">
        Set to <code class="literal">true</code> in order to turn hyphenation on. This requires a
        dictionary to be set with the parameter <code class="parameter">hyphendict</code>. Defaults to
        <code class="literal">false</code>.
       </p>
      </dd>

     
     
      <dt>
hyphendict (parameter)</dt>

      <dd>

       <p class="para">
        Filename of the dictionary used for hyphenation pattern (see below).
       </p>
      </dd>

     
     
      <dt>
hyphenminchar (value)</dt>

      <dd>

       <p class="para">
        The number of chars which must at least be left over before or after
        the hyphen. This implies that only words of at least two times this
        value will be hyphenated. The default value is three. Setting a value
        of zero will result in the default value.
       </p>
      </dd>

     
     
      <dt>
parindent (value)</dt>

      <dd>

       <p class="para">
        Set the amount of space in pixel for indenting the first m lines of a
        paragraph. m can be set with the value <code class="literal">numindentlines</code>.
       </p>
      </dd>

     
     
      <dt>
parskip (value)</dt>

      <dd>

       <p class="para">
        Set the amount of extra space in pixel between paragraphs. Defaults to
        <code class="literal">0</code> which will result in a normal line distance.
       </p>
      </dd>

     
     
      <dt>
numindentlines (value)</dt>

      <dd>

       <p class="para">
        Number of lines from the start of the paragraph which will be indented.
        Defaults to <code class="literal">1</code>.
       </p>
      </dd>

     
     
      <dt>
parindentskip (value)</dt>

      <dd>

       <p class="para">
        Number of paragraphs in the box whose first lines will not be indented.
        This defaults to <code class="literal">0</code>. This is useful for paragraphs right after a section
        heading or text being continued in a second box. In both case one would
        set this to <code class="literal">1</code>.
       </p>
      </dd>

     
     
      <dt>
linenumbermode (parameter)</dt>

      <dd>

       <p class="para">
        Set how lines are to be numbered. Possible values are <code class="literal">box</code> for
        numbering lines in the whole box or <code class="literal">paragraph</code> to number lines within
        each paragraph.
       </p>
      </dd>

     
     
      <dt>
linenumberspace (value)</dt>

      <dd>

       <p class="para">
        The space for the column left of the numbered line containing the line
        number. The line number will be right justified into this column.
        Defaults to <code class="literal">20</code>.
       </p>
      </dd>

     
     
      <dt>
linenumbersep (value)</dt>

      <dd>

       <p class="para">
        The space between the column with line numbers and the line itself.
        Defaults to <code class="literal">5</code>.
       </p>
      </dd>

     
    </dl>

   </p>
  </div>


  <div class="refsect2 unknown-unknown-parameteru" id="refsect2-function.ps-show-boxed-unknown-unknown-parameteru">
   <h4 class="title">Hyphenation</h4>
   <p class="para">
    Text is hyphenated if the parameter <code class="literal">hyphenation</code> is set
    to true and a valid hyphenation dictionary is set. pslib does not ship its own
    hyphenation dictionary but uses one from openoffice, scribus or koffice.
    You can find their dictionaries for different languages in one of the
    following directories if the software is installed:
    <ul class="simplelist">
     <li class="member">
      <var class="filename">/usr/share/apps/koffice/hyphdicts/</var>
     </li>
     <li class="member">
      <var class="filename">/usr/lib/scribus/dicts/</var>
     </li>
     <li class="member">
      <var class="filename">/usr/lib/openoffice/share/dict/ooo/</var>
     </li>
    </ul>
    Currently scribus appears to have the most complete hyphenation
    dictionaries.
   </p>
  </div>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ps-show-boxed-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Number of characters that could not be written.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ps-show-boxed-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.ps-continue-text.html" class="function" rel="rdfs-seeAlso">ps_continue_text()</a> - Continue text in next line</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>